package com.andiary.common;

import com.andiary.common.database.*;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
import android.widget.DatePicker;
import java.util.logging.*;

import android.util.Log;

public class Andiary extends Activity {
    /** Called when the activity is first created. */
	private static Logger logger = Logger.getLogger("DBCreation");
	SQLiteDatabase diarydb = null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ImageButton startnote = (ImageButton) findViewById (R.id.widget32);
        startnote.setOnClickListener(new View.OnClickListener() {

        	public void onClick(View view) {
        		
            	try{	
            		
                    Intent inote = new Intent(Andiary.this,com.andiary.common.note.Note.class);	
                    startActivity(inote);
          		
        			}catch  (Throwable t) {
        				
        			}
        		
        	}
          
        });
        
        Button createdb = (Button) findViewById(R.id.createdbbutton);
        createdb.setOnClickListener(new OnClickListener()
      
        {
        //@Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            //	activateButton1.setEnabled(false);
        	logger.info("Calling activity.....");
            Intent dbinit = new Intent(Andiary.this, InitializeDB.class);
            startActivity(dbinit);
        	}
    });
    }
        @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	boolean result = super.onCreateOptionsMenu(menu);
    	menu.add(0, 1, 0, R.string.event).setIcon(R.drawable.event1);
        menu.add(0, 2, 0, R.string.help).setIcon(R.drawable.help);
        menu.add(0, 3, 0, R.string.about).setIcon(R.drawable.about);
        return result;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	switch (item.getItemId()) {
        case 1:
        	Toast.makeText(Andiary.this, "Is a personal Diary for Notes, Ideas and Thoughts ", Toast.LENGTH_LONG).show();
            break;
        case 2:
        	Toast.makeText(Andiary.this, "Easy to use",Toast.LENGTH_LONG).show();
        	break;
        case 3:
        	Toast.makeText(Andiary.this, "Version 1.0" , Toast.LENGTH_LONG).show();
        	break;
        }
        return super.onOptionsItemSelected(item);
    }
    
    
}